package com.lyn.io.file

import android.graphics.Bitmap
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.io.InputStream
import java.io.PrintStream
import java.util.zip.ZipInputStream

/**
 *
 * @author longyn 2025/02/28
 * @version 1.0.0
 */
interface Folder {

    fun initialize(path: String, name: String, isCreate: Boolean): Boolean

    fun getName(): String

    fun getRootPath(): String

    fun existFile(name: String): Boolean

    fun getAllFileName(): MutableList<String>

    fun createFolder(name: String): File

    fun createFile(name: String): File

    fun reName(oldName: String, newString: String): File?

    fun getFile(name: String): File

    fun readFile(name: String): String

    fun writeFile(name: String, value: String, append: Boolean = false): String

    fun writeFile(file: File, name: String): String

    fun writeFile(file: File, name: String, closeInputStream: Boolean): String

    fun writeFile(inputStream: InputStream, name: String, closeInputStream: Boolean): String

    fun getFileInputStream(name: String): FileInputStream?

    fun getFileOutPutStream(name: String): FileOutputStream?

    fun deleteFile(name: String)

    fun updateFileName(oldName: String, newString: String): String

    fun getBitmap(name: String): Bitmap?

    fun writeBitmap(
        name: String,
        bitmap: Bitmap,
        format: Bitmap.CompressFormat = Bitmap.CompressFormat.JPEG,
        quality: Int = 100
    ): String

    fun <T> readXls(
        name: String,
        startRow: Int = 0,
        endRow: Int = 0,
        sheetPosition: Int = 0,
        curClass: Class<T>
    ): MutableList<T>

    fun <T> readXls(
        inputStream: InputStream,
        startRow: Int = 0,
        endRow: Int = 0,
        sheetPosition: Int = 0,
        curClass: Class<T>
    ): MutableList<T>

    fun <T> writeXls(
        name: String,
        writeTitle: Boolean = true,
        sheet: String = "sheet",
        sheetPosition: Int = 0,
        dataList: MutableList<T>,
        curClass: Class<T>
    ): String


    fun getPrintStream(name: String): PrintStream?


    fun writeStackTrace(name: String, throwable: Throwable): String
}